<?php

$dirpath = __DIR__ . '/lib';
$files = scandir($dirpath);
$aFileContent = array();
foreach ($files as $file) {
    if ($file === '.' || $file === '..') continue;
    if (!preg_match('/\.min\.js$/i', $file)) continue;
    $filepath = $dirpath . '/' . $file;
    if (!is_file($filepath)) continue;
    $aFileContent[] = file_get_contents($filepath);
}
//$aFileContent[] = file_get_contents(__DIR__ . '/vue/common.js');
$sFileContent = implode("\r\n", $aFileContent);
file_put_contents(__DIR__ . '/lib.js', $sFileContent);
header('Location: lib.js');
